package br.com.news.database.daos;

import java.util.List;

import javax.inject.Named;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import br.com.news.database.daos.interfaces.IAnuncioDao;
import br.com.news.database.entities.AnuncioEntity;
import br.com.news.database.utils.GenericDao;

@Named
public class AnuncioDao extends GenericDao<AnuncioEntity, Long> implements IAnuncioDao{

	@SuppressWarnings("unchecked")
	@Override
	public List<AnuncioEntity> buscaAnunciosNaoEnviados() {
		Criteria criteria = getSession().createCriteria(AnuncioEntity.class);
		criteria.add(Restrictions.eq("flagEnvioEmail", false));
		return criteria.list();
	}
	
}
